<meta charset="utf-8"/>
<script type="text/javascript" src="modeles/jquery.js"></script>
<script type ="text/javascript" src="modeles/javascriptFonctions.js"></script>

<h2>Fiche action</h2>

<?php
	if(isset($_SESSION["erreur"]))
	{
		foreach($_SESSION["erreur"] as $e)
		{
			echo $e."</br>";
		}
		unset($_SESSION["erreur"]);
	}

echo '<br/>
<form action="index.php?module=actionComm&amp;action=verificationFormulaireBilan&amp;'.ID_ADC.'='.$_GET[ID_ADC].'" method="post" onSubmit="return verifFormulaire()">
	<table id="tabTache">
		<tr>
			<th>
				<label for="TacheRealise">Tâches réalisées</label>
			</th>
			<th>
				<label for="Echeance">Echéance</label>
			</th>
			<th>
				<label for="Responsable">Responsable</label>
			</th>
		</tr>
		<tr>
			<td>
				<input type="text" name="TacheRealise[]" class="champ"';
				if(isset($_POST["TacheRealise"])) // permet de garder les infos deja saisies
						echo  'value="'.$_POST["TacheRealise"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
			<td>
				<input type="text" name="Echeance[]" class="champ"';
				if(isset($_POST["Echeance"])) // ""
						echo  'value="'.$_POST["Echeance"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
			<td>
				<input type="text" name="Responsable[]"" class="champ"';
				if(isset($_POST["Responsable"])) // ""
						echo  'value="'.$_POST["Responsable"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
		</tr>
		<tr  id="ajoutTache">';
		if(isset($_POST["TacheRealise"])) // rajoute les champs si infos dedans
		{
			for($i=1;$i<count($_POST["TacheRealise"]);$i++)
			{
				if(isset($_POST["TacheRealise"][$i]) && (!empty($_POST["TacheRealise"][$i]) || !empty($_POST["Echeance"][$i]) || !empty($_POST["Responsable"][$i])))
				{
					echo '<script>javascript:ajoutTache("'.$_POST["TacheRealise"][$i].'","'.$_POST["Echeance"][$i].'","'.$_POST["Responsable"][$i].'")</script>';
				}
			}
		}
echo '
		
			<td>
				<input type="button" name="Plus" value="Ajouter une tâche" onClick="ajoutTache()"/>
			</td>
		</tr>
	</table>
	
	<p>
		<h4>Dépenses</h4><hr/>
	</p>
	<table id="tabDepense">
		<tr>
			<th>
				<label for="NatureDepense">Nature</label>
			</th>
			<th>
				<label for="BudgetDepense">Budgets </label>
			</th>
			<th>
				<label for="Fournisseur">Fournisseur</label>
			</th>
		</tr>
		<tr>
			<td>
				<input type="text" name="NatureDepense[]" class="champ"';
				if(isset($_POST["NatureDepense"])) // permet de garder les infos deja saisies
						echo  'value="'.$_POST["NatureDepense"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
			<td>
				<input type="text" name="BudgetDepense[]" class="champ"';
				if(isset($_POST["BudgetDepense"])) // ""
						echo  'value="'.$_POST["BudgetDepense"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
			<td>
				<input type="text" name="Fournisseur[]" class="champ"';
				if(isset($_POST["Fournisseur"])) // ""
						echo  'value="'.$_POST["Fournisseur"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
			<td>
				<input type="button" value="-" onClick="enleveLigne(this,\'tabDepense\')"/>
			</td>
		</tr>
		<tr  id="ajoutDepense">';
		if(isset($_POST["NatureDepense"])) // rajoute les champs si infos dedans
		{
			for($i=1;$i<count($_POST["NatureDepense"]);$i++)
			{
				if(isset($_POST["NatureDepense"][$i]) && (!empty($_POST["NatureDepense"][$i]) || !empty($_POST["BudgetDepense"][$i]) || !empty($_POST["Fournisseur"][$i])))
				{
					echo '<script>javascript:ajoutDepense("'.$_POST["NatureDepense"][$i].'","'.$_POST["BudgetDepense"][$i].'","'.$_POST["Fournisseur"][$i].'")</script>';
				}
			}
		}
echo '
			<td>
				<input type="button" name="Plus" value="Ajouter une dépense" onClick="ajoutDepense()"/>
			</td>
		</tr>
	</table>
	
	</p>
		<h4>Recettes</h4><hr/>
	<p>
	<table id="tabRecette">
		<tr>
			<th>
				<label for="NatureRecette">Nature</label>
			</th>
			<th>
				<label for="BudgetsRecette">Budgets</label>
			</th>
		</tr>
		<tr>
			<td>
				<input type="text" name="NatureRecette[]" class="champ"';
				if(isset($_POST["NatureRecette"]))// permet de garder les infos deja saisies
						echo  'value="'.$_POST["NatureRecette"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
			<td>
				<input type="text" name="BudgetRecette[]" class="champ"';
				if(isset($_POST["BudgetRecette"]))// ""
						echo  'value="'.$_POST["BudgetRecette"][0].'"';
echo ' onBlur="verifChamp(this)" onFocus="blanc(this)"/>
			</td>
			<td>
				<input type="button" value="-" onClick="enleveLigne(this,\'tabRecette\')"/>
			</td>
		</tr>
		<tr  id="ajoutRecette">';
		if(isset($_POST["NatureRecette"])) // rajoute les champs si infos dedans
		{
			for($i=1;$i<count($_POST["NatureRecette"]);$i++)
			{
				if(isset($_POST["NatureRecette"][$i]) && (!empty($_POST["NatureRecette"][$i]) || !empty($_POST["BudgetRecette"][$i])))
				{
					echo '<script>javascript:ajoutRecette("'.$_POST["NatureRecette"][$i].'","'.$_POST["BudgetRecette"][$i].'")</script>';
				}
			}
		}
echo '
			<td>
				<input type="button" name="Plus" value="Ajouter une recette" onClick="ajoutRecette()"/>
			</td>
		</tr>
	</table>
	
	<h4>Points positifs</h4><hr/>
	<p>
		<textarea name="PointPositif" cols="100" rows="10"></textarea>
	</p>
	<h4>Points négatifs</h4><hr/>
	<p>
		<textarea name="PointNegatif" cols="100" rows="10"></textarea>
	</p>
	<h4>Bon à savoir</h4><hr/>
	<p>
		<textarea name="BonASavoir" cols="100" rows="10">Astuces, personnes ressources...</textarea>
	</p>
	<h4>Suggestions</h4><hr/>
	<p>
		<textarea name="Suggestion" cols="100" rows="10"></textarea>
	</p>
	<p>
		<span id="erreur"></span>
	</p>
	<p>
		<input type="submit" value="Annuler" name="annuler"/>
		<input type="submit" value="Envoyer" name="envoyerFicheADC"/>
	</p>
</form>';